Skip to content

Conversation

@loryhndol
Copy link

The original function draw_line may create some artifacts during rasterization. I would like to add the DDA algorithm because it's simple and easy to understand.

@OmarShehata
Copy link
Owner

Hey, thanks for opening this PR!

Do you have a before/after images you can share of what it looks like using this? Also this PR is adding the function but not actually using it to draw, is that intentional?

1. Replace `DDA_round` with builtin function `round` and `max`
2. Describe the procedure with comments
@loryhndol
Copy link
Author

The screenshot below shows the difference between the result of original and my DDA implementation. The original result was colored in red and DDA result was colored in white. The result was rendered on <canvas width="539" height="269"></canvas>.

I have to admit that the aliasing is quite unnoticeable owing to the high-resolution LCD screen.

screenshot

Comparison using the suzanne model

The original method

original_suzanne

DDA method

DDA_suzanne

Please see the latest update of the PR. I have made some changes to improve the quality of the code. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants